home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / perl / perl5a1.lha / perl5alpha1 / Bugs / crash1 next >
Encoding:
Text File  |  1993-03-21  |  674 b   |  24 lines

  1. #!./perl
  2. # These filenames doesn't seem to matter, as long as the first one exists,
  3. # and we have permission to create the second one.
  4. open(OLD_FILE, "/etc/passwd");
  5. open(NEW_FILE, ">/tmp/foobar");
  6.  
  7. # This line is unnecessary to trigger death, but it helps to show where
  8. # we crash and burn.
  9. $| = 1;
  10.  
  11. #  Seemingly, this loop is necessary to activate the bug.  If I just say
  12. #     $_ = <OLD_FILE>
  13. #  instead of the loop, everything works as expected.
  14. while (<OLD_FILE>) {
  15.   #  This was originally just a random typing spaz on my part, but it causes
  16.   #  perl to crash later.
  17.   print <NEW_FILE>;
  18. }
  19.  
  20. print "About to die...\n";
  21. print "dest = '$dest'\n";
  22. print "Didn't die!\n";
  23.  
  24.